package ca.uguu.gamelib.libgdx.structures;

public class BoundedInt {
	protected int value = Integer.MAX_VALUE;
	protected int max = Integer.MAX_VALUE;
	
	public BoundedInt(){
	}
	public BoundedInt(int value){
		this.value = value;
	}
	
	public void setMax(int limit){
		this.max = limit;
		this.value = Math.min(limit, this.value);
	}
	public int get(){
		return this.value;
	}
	public void adjust(int delta){
		this.value = Math.max(0, Math.min(this.max, this.value + delta));
	}
}
